const express = require('express');
const asyncHandler = require('express-async-handler');
const basicControl = require('../controllers/basic.controller');
const xionganControl = require('../controllers/xiongan.controller')
const router = express.Router();
module.exports = router;

router.post('/getEventsPreview', asyncHandler(getEventsPreview))
router.post('/getSafetyEvents',asyncHandler(getFourSafetyEvents))
router.post('/getMainChannelLeanEvents',asyncHandler(getFourMainChannelLeanEvents))
router.post('/getWorkingAreaLeanEvents',asyncHandler(getFourWorkingAreaLeanEvents))

async function getEventsPreview(req, res) {
    let result = await xionganControl.getEventsPreview(req.body.unionId)
    res.json(result)
}

async function getFourSafetyEvents(req,res){
    let result = await xionganControl.getFourSafetyEvents(req.body.unionId)
    res.json(result)
}

async function getFourMainChannelLeanEvents(req,res){
    let result = await xionganControl.getFourMainChannelLeanEvents (req.body.unionId)
    res.json(result)
}

async function getFourWorkingAreaLeanEvents(req,res){
    let result = await xionganControl.getFourWorkingAreaLeanEvents(req.body.unionId)
    res.json(result)
}

async function getTowerCraneData(req,res){
    let result
}